#ifndef _socketutil_H_
#define _socketutil_H_

#ifdef _cplusplus
extern 'C'
{
#endif // _cplusplus
#include <unistd.h>
#include <sys/types.h>
#include <fcntl.h>
#include <sys/select.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
	void activate_nonblock(int fd);
	void deactivate_nonblock(int fd);
	int read_timeout(int fd, unsigned int wait_seconds);
	int write_timeout(int fd, unsigned int wait_seconds);
	int accept_timeout(int fd, struct sockaddr_in* addr, unsigned int wait_seconds);
	int connect_timeout(int fd, struct sockaddr_in* addr, unsigned int wait_seconds);
	ssize_t readn(int fd, void* buf, size_t count);
	ssize_t writen(int fd, const void* buf, size_t count);
	ssize_t recv_peek(int sockfd, void* buf, size_t len);
	ssize_t readline(int sockfd, void* buf, size_t maxline);

#ifdef _cplusplus
}
#endif

#endif // !_socketutil_H_
